/** 
 *  格式化文章發布時間
 */
import marked from 'marked'

marked.setOptions({
  renderer: new marked.Renderer(),
  gfm: true,
  tables: true,
  breaks: false,
  pedantic: false,
  sanitize: true,
  smartLists: true,
  smartypants: false
});

export const formatDate =  time => {
  let tmpDate = new Date(time);
  let year = tmpDate.getFullYear();
  let month = tmpDate.getMonth() + 1;
  let day = tmpDate.getDate();
  let hours = tmpDate.getHours();
  let minutes = tmpDate.getMinutes();
  return year + '.' + month + '.' + day + ' ' + hours + ':' + minutes
};

export const mark = item =>(
    marked(item)
);